home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 2003 #3 / K-CD-3-2003.ISO / WinXP Service Pack 1 / xpsp1_sv_x86.exe / ipp_0006.as_ / ipp_0006.asp
Encoding:
Text File  |  2002-08-01  |  5.4 KB  |  181 lines

  1. ∩╗┐<%@ CODEPAGE=65001 %> 
  2. <%
  3. ' Replace the above line with your localized code page number
  4. '------------------------------------------------------------
  5. '
  6. ' Microsoft Internet Printing Project
  7. '
  8. ' Copyright (c) Microsoft Corporation. All rights reserved.
  9. '
  10. '------------------------------------------------------------
  11.     option explicit
  12.  
  13. %>
  14. <!-- #include file = "ipp_util.inc" -->
  15. <%
  16.     Const L_OpenPrinter_Text = "├ûppna skrivare"    
  17.      
  18.     CheckSession
  19.     Response.Expires = 0
  20.  
  21.     Dim strPrinter, strComputer, objQueue, objJobs, strAction, iRes
  22.     Dim objPrinter
  23.  
  24.     On Error Resume Next
  25.     Err.Clear
  26.  
  27.     strPrinter = OleCvt.DecodeUnicodeName (request ("eprinter"))
  28.  
  29.     strComputer = Session(COMPUTER)
  30.     Set objQueue = GetObject("WinNT://" & strComputer & "/" & strPrinter & ",PrintQueue")
  31.     Set objJobs = objQueue.PrintJobs
  32.  
  33.     Set objPrinter = Server.CreateObject(PROGID_HELPER)
  34.     objPrinter.open "\\" & strComputer & "\" & strPrinter
  35.     If Err Then
  36.         Call ErrorHandler (L_OpenPrinter_Text)
  37.     End If
  38.  
  39. Function isSupported(bSupported)
  40.     Const L_Supported_Text = "St├╢ds"
  41.     Const L_Unsupported_Text = "St├╢ds inte"
  42.     If bSupported = 1 Then
  43.         isSupported = L_Supported_Text
  44.     Else
  45.         isSupported = L_Unsupported_Text
  46.     End If
  47. End Function
  48.  
  49.     Dim strTitle
  50.     Const L_Title_Text = "<title>Skrivaregenskaper f├╢r %1 p├Ñ %2</title>"
  51.     strTitle = RepString2(L_Title_Text, strCleanString(strPrinter), session(LOCAL_SERVER))
  52.  
  53. %>
  54. <html>
  55.  
  56. <head>
  57. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
  58. <%=SetCodePage%>
  59. <meta http-equiv="refresh" content="30">
  60. <% =Write (strTitle) %>
  61. </head>
  62.  
  63.  
  64. <%
  65. Function GetString (str)
  66.  
  67.     If str = "" Then
  68.         GetString = " "
  69.     Else
  70.         GetString = strCleanString (str)
  71.     End If
  72. End Function
  73.  
  74. Function GenPropertyTable (objQueue, objPrinter)
  75.     Dim strHTML
  76.     Dim strBgnCol1, strBgnCol2, strEndCol
  77.     Dim strBgnRow, strEndRow
  78.     Dim strTmp, strUnit
  79.     Dim strUrl
  80.     Dim i, arrayNameList, iUnit
  81.  
  82.     Const L_PrinterModel_Text = "Skrivarmodell:"
  83.     Const L_Status_Text       = "Status:"
  84.     Const L_Location_Text     = "Plats:"
  85.     Const L_Comment_Text      = "Kommentar:"
  86.     Const L_Url_Text          = "N├ñtverksnamn:"
  87.     Const L_Jobs_Text         = "Dokument:"
  88.     Const L_Speed_Text        = "Hastighet:"
  89.     Const L_BgnSpeed_Text     = ""
  90.     Const L_Duplex_Text       = "Dubbelsidig utskrift:"
  91.     Const L_Color_Text        = "F├ñrgutskrift:"
  92.     Const L_Resolution_Text   = "H├╢gsta uppl├╢sning:"
  93.  
  94.     strHTML = ""
  95.  
  96.     strBgnCol1 = "<tr><td width=""138"" valign=""top"">" & DEF_FONT_TAG & "<b>"
  97.     strBgnCol2 = "</b>" & END_FONT & "</td><td>" & DEF_FONT_TAG
  98.     strEndCol  = END_FONT & "</td></tr>"
  99.  
  100.     strHTML = strHTML & strBgnCol1 & L_PrinterModel_Text & strBgnCol2 & GetString(objQueue.model) & strEndCol
  101.     strHTML = strHTML & strBgnCol1 & L_Location_Text & strBgnCol2 & _
  102.               GetString (objQueue.Location) & strEndCol 
  103.     strHTML = strHTML & strBgnCol1 & L_Comment_Text & strBgnCol2 & _
  104.               GetString (objQueue.Description) & strEndCol 
  105.  
  106.     If Request.ServerVariables("HTTPS") = "off" Then
  107.         strUrl = "http://"
  108.     Else
  109.         strUrl = "https://"
  110.     End If
  111.  
  112.     strUrl = GetString(strUrl & session(LOCAL_SERVER) & "/printers/" & GetFriendlyName (objQueue.Printerpath, strComputer) & "/.printer")
  113.  
  114.     strHTML = strHTML & strBgnCol1 & L_Url_Text & strBgnCol2 & strUrl & strEndCol 
  115.     strHTML = strHTML & strBgnCol1 & L_Jobs_Text & strBgnCol2 & objQueue.JobCount & strEndCol
  116.  
  117.     On Error Resume Next
  118.     Err.Clear
  119.  
  120.     iUnit = objPrinter.PageRateUnit
  121.     If Err.Number = 0 Then
  122.         strTmp = objPrinter.PageRate
  123.         If Err.Number = 0 And strTmp <> "0" Then
  124.             Const L_PPM_Text = " PPM (sidor per minut)"
  125.             Const L_CPS_Text = " CPS (tecken per sekund)"
  126.             Const L_LPM_Text = " LPM (rader per minut)"
  127.             Const L_IPM_Text = " IPM (tum per minut)"
  128.  
  129.             Select Case iUnit
  130.             Case 1
  131.                 strUnit = L_PPM_Text
  132.             Case 2
  133.                 strUnit = L_CPS_Text
  134.             Case 3
  135.                 strUnit = L_LPM_Text
  136.             Case 4
  137.                 strUnit = L_IPM_Text
  138.             End Select
  139.  
  140.             strHTML = strHTML & strBgnCol1 & L_Speed_Text & L_BgnSpeed_Text & strBgnCol2 & strTmp & strUnit & strEndCol
  141.         End If
  142.     End If
  143.     Err.Clear
  144.  
  145.     strTmp = objPrinter.Color
  146.     If Err.Number = 0 Then
  147.         strHTML = strHTML & strBgnCol1 & L_Color_Text & strBgnCol2 & isSupported (strTmp) & strEndCol
  148.     End If
  149.     Err.Clear
  150.  
  151.  
  152.     strTmp = objPrinter.Duplex
  153.     If Err.Number = 0 Then
  154.         strHTML = strHTML & strBgnCol1 & L_Duplex_Text & strBgnCol2 & isSupported (strTmp) & strEndCol 
  155.     End If
  156.     Err.Clear
  157.  
  158.     strTmp = objPrinter.MaximumResolution
  159.     If Err.Number = 0 Then
  160.         Const L_DPI_Text = " DPI (punkter per tum)"
  161.         strHTML = strHTML & strBgnCol1 & L_Resolution_Text & strBgnCol2 & strTmp & L_DPI_Text & strEndCol 
  162.     End If
  163.  
  164.     GenPropertyTable = strHTML
  165.  
  166. End Function
  167. %>
  168.  
  169. <body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000" alink="#000000"
  170. topmargin="0" leftmargin="0">
  171.  
  172. <table border="0" cellpadding="2" cellspacing="0" width="100%">
  173. <%=Write (GenPropertyTable (objQueue, objPrinter))%>
  174. </table>
  175.  
  176. <%
  177.     objPrinter.close
  178. %>
  179.  
  180. </body>
  181. </html>